package 开始的剑指offer8月.测试;
import java.util.*;
public class Solution {
    public  static ArrayList<Double> findPoints (double[] data) {
        ArrayList<Double> list=new ArrayList<>();
        double a[];
        int j;
        for(int i=1;i<data.length;i++){
            if(data[i]>data[i-1]&&data[i]<data[i+1]){
                a=new double[data.length-i];
                j=i;
                for (int k = 0; k <data.length-i ;k++) {
                    a[k]=data[j];
                    j++;
                }
                if(ismin(i,a)){
                    list.add(data[i]);
                }
            }
        }







        return list;
    }
    public static boolean ismin(int i,double a[]){
        double min=a[i];
        for(int j=i;j<a.length;j++){
            if(a[j]<min){
                return false;
            }
        }
        return  true;
    }
    public static void main(String[] args) {
        System.out.println(ismin(4,new double[]{-1.1, 3, 7, 79.6, 9.8}));
        System.out.println(findPoints(new double[]{-1.1, 3, 7, 79.6, 9.8}));
        System.out.println(findPoints(new double[]{-5, -2.2, 19, 28, 19, -1.5}));
        System.out.println(findPoints(new double[]{0, -2.2, 11, 22, 15,-18}));
    }
}







